#ifndef RTW_HEADER_PID_controller_h_
#define RTW_HEADER_PID_controller_h_
#include "rtwtypes.h"
#include <math.h>
#ifndef PID_controller_COMMON_INCLUDES_
# define PID_controller_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif

typedef struct tag_RTM RT_MODEL;

#ifndef DEFINED_TYPEDEF_FOR_angel_desired_
#define DEFINED_TYPEDEF_FOR_angel_desired_

typedef struct {
  real_T throttle_d;
  real_T yaw_d;
  real_T roll_d;
  real_T pitch_d;
} angel_desired;

#endif

#ifndef DEFINED_TYPEDEF_FOR_angle_rate_
#define DEFINED_TYPEDEF_FOR_angle_rate_

typedef struct {
  real_T r_m;
  real_T p_m;
  real_T q_m;
} angle_rate;

#endif

#ifndef DEFINED_TYPEDEF_FOR_angle_solved_
#define DEFINED_TYPEDEF_FOR_angle_solved_

typedef struct {
  real_T yaw_s;
  real_T roll_s;
  real_T pitch_s;
} angle_solved;

#endif

#ifndef DEFINED_TYPEDEF_FOR_pwm_controller_out_
#define DEFINED_TYPEDEF_FOR_pwm_controller_out_

typedef struct {
  real_T pwm1;
  real_T pwm2;
  real_T pwm3;
  real_T pwm4;
} pwm_controller_out;

#endif

typedef struct {
  real_T roll_e;
  real_T roll_rate_d;
  real_T pitch_e;
  real_T pitch_rate_d;
  real_T yaw_e;
  real_T yaw_rate_d;
  real_T yaw_feedforward_gain;
  real_T r_e;
  real_T yaw_distribution;
  real_T p_e;
  real_T roll_distribution;
  real_T q_e;
  real_T pitch_distribution;
  real_T w1;
  real_T w2;
  real_T w3;
  real_T yaw_rate_e_int;
  real_T roll_rate_e_int;
  real_T pitch_rate_e_int;
} DW;

struct P_ {
  real_T PITCH_P;
  real_T PITCH_DISTRIBUTION_MAX;
  real_T PITCH_MAX;
  real_T PITCH_RATE_I;
  real_T PITCH_RATE_P;
  real_T PITCH_RATE_MAX;
  real_T PWM_MAX;
  real_T PWM_MIN;
  real_T ROLL_P;
  real_T ROLL_DISTRIBUTION_MAX;
  real_T ROLL_MAX;
  real_T ROLL_RATE_I;
  real_T ROLL_RATE_P;
  real_T ROLL_RATE_MAX;
  real_T YAW_P;
  real_T YAW_DISTRIBUTION_MAX;
  real_T YAW_FEEDFORWARD_GAIN;
  real_T YAW_RATE_I;
  real_T YAW_RATE_P;
  real_T YAW_RATE_MAX;
  real_T yaw_rate_PID_Kb;
  real_T pitch_rate_PID_Kb;
  real_T roll_rate_PID_Kb;
  real_T Integrator_gainval;
  real_T Integrator_IC;
  real_T Integrator_gainval_p;
  real_T Integrator_IC_p;
  real_T Integrator_gainval_j;
  real_T Integrator_IC_l;
};

typedef struct P_ P;
struct tag_RTM {
  struct {
    struct {
      uint8_T TID[2];
    } TaskCounters;
  } Timing;
};

extern P rtP;
extern DW rtDW;
extern void PID_init(void);
extern void PID_step(angel_desired *arg_angle_desired, angle_rate
                     *arg_angle_rate, angle_solved *arg_angle_solved,
                     pwm_controller_out *arg_pwm);
extern RT_MODEL *const rtM;

#endif

